<?php

require_once('../qcubed/includes/configuration/prepend.inc.php');
require_once('../build/includes/config.php');
require_once('../data/lookups.php');


switch ($_GET["event"]) {
	case "enddrag" :
		$bug = MantisBugTable::LoadById(intval($_GET["bugid"]));
		
		$bug->StartDate = new QDateTime(date('Y-m-d H:i:s', $_GET["start"]));
		$bug->EndDate = new QDateTime(date('Y-m-d H:i:s', $_GET["end"]));
		
		$bug->Save();
		
		break;
	
	case "endresize" :
		$bug = MantisBugTable::LoadById(intval($_GET["bugid"]));
		
		$bug->EndDate = new QDateTime(date('Y-m-d H:i:s', $_GET["end"]));
		
		$bug->Save();
		
		break;
}


print("Saved: " . $bug->StartDate->qFormat('MMM DD YYYY', QDateTime::Now()->GetTimeZone()));
print(" - " . $bug->EndDate->qFormat('MMM DD YYYY', QDateTime::Now()->GetTimeZone()));

?>